package com.fsm.system.controller;

import com.fsm.common.log.config.LogData;
import com.fsm.common.log.entity.dto.OperationEnum;
import com.fsm.common.log.entity.dto.SystemTypeEnum;
import com.fsm.common.tools.Result.Result;
import com.mybatisflex.core.paginate.Page;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import com.fsm.system.entity.TSystemMenu;
import com.fsm.system.service.TSystemMenuService;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import java.io.Serializable;
import java.util.List;

/**
*  菜单管理控制层。
*
* @author
* @since
*/
@RestController
@Tag(name = "菜单管理")
@RequestMapping("/tSystemMenu")
public class TSystemMenuController {

	@Autowired
	private TSystemMenuService systemUserService;

	/**
    * 添加菜单管理
    *
    * @param tSystemMenu
    * @return
    */
	@LogData(value = "添加菜单管理",operation = OperationEnum.INSERT,systemTypeEnum = SystemTypeEnum.BACKEND)
    @PostMapping("addTSystemMenu")
    @Operation(summary="添加菜单管理",description="添加菜单管理")
    public Result addTSystemMenu(@RequestBody TSystemMenu tSystemMenu) throws Exception{
		return systemUserService.addTSystemMenu(tSystemMenu);
	}

	/**
	* 删除菜单管理
	*
	* @param tSystemMenu
	* @return
	*/
	@LogData(value = "删除菜单管理",operation = OperationEnum.DELETE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("deleteTSystemMenu")
	@Operation(summary="删除菜单管理",description="删除菜单管理")
	public Result deleteTSystemMenu(@RequestBody TSystemMenu tSystemMenu) throws Exception{
		return systemUserService.deleteTSystemMenu(tSystemMenu);
	}

	/**
	* 更新菜单管理
	*
	* @param tSystemMenu
	* @return
	*/
	@LogData(value = "更新菜单管理",operation = OperationEnum.UPDATE,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("updateTSystemMenu")
	@Operation(summary="更新菜单管理",description="更新菜单管理")
	public Result updateTSystemMenu(@RequestBody TSystemMenu tSystemMenu) throws Exception{
		return systemUserService.updateTSystemMenu(tSystemMenu);
	}

	/**
	* 分页查询菜单管理
	*
	* @param tSystemMenu
	* @return 分页对象
	*/
	@LogData(value = "分页查询菜单管理",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("pageTSystemMenu")
	@Operation(summary="分页查询菜单管理",description="分页查询菜单管理")
	public Result pageTSystemMenu(@RequestBody TSystemMenu tSystemMenu) throws Exception{
		return systemUserService.pageTSystemMenu(tSystemMenu);
	}

	/**
	* 查询菜单管理列表
	*
	* @param tSystemMenu
	* @return 分页对象
	*/
	@LogData(value = "查询菜单管理列表",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("getTSystemMenuList")
	@Operation(summary="查询菜单管理列表",description="查询菜单管理列表")
	public Result getTSystemMenuList(@RequestBody TSystemMenu tSystemMenu) throws Exception{
		return systemUserService.getTSystemMenuList(tSystemMenu);
	}

	/**
	* 通过ID查询菜单管理
	*
	* @param tSystemMenu
	* @return
	*/
	@LogData(value = "通过ID查询菜单管理",operation = OperationEnum.SELECT,systemTypeEnum = SystemTypeEnum.BACKEND)
	@PostMapping("getTSystemMenuById")
	@Operation(summary="通过ID查询菜单管理",description="通过ID查询菜单管理")
	public Result getTSystemMenuById(@RequestBody TSystemMenu tSystemMenu) throws Exception{
		return systemUserService.getTSystemMenuById(tSystemMenu);
	}
}
